package com.brozers.islamdini;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class TimeSQLiteHelper extends SQLiteOpenHelper{

	  public static final String TABLE_TIMES = "times";
	  public static final String COLUMN_ID = "_id";
	  public static final String COLUMN_CITY_ID = "cityid";
	  public static final String COLUMN_PRAYERTIME = "prayertime";
	  public static final String COLUMN_DAYOFYEAR = "dayofyear";
	  public static final String COLUMN_DAY = "day";
	  public static final String COLUMN_MONTH = "month";

	  private static final String DATABASE_NAME = "times.db";
	  private static final int DATABASE_VERSION = 4;

	  private static final String DATABASE_CREATE = "create table "
	      + TABLE_TIMES + "(" + COLUMN_ID
	      + " integer primary key autoincrement, " + COLUMN_PRAYERTIME 
	      + " text not null, " + COLUMN_CITY_ID + " text not null, " + COLUMN_DAYOFYEAR
	      + " text not null, " + COLUMN_DAY
	      + " text not null, " + COLUMN_MONTH
	      + " text not null);";
	  
	public TimeSQLiteHelper(Context context) {
		super(context, DATABASE_NAME, null, DATABASE_VERSION);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
	db.execSQL(DATABASE_CREATE);	
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
	db.execSQL("DROP TABLE IF EXISTS "+ TABLE_TIMES);
	onCreate(db);
	}

}
